package com.person.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.person.daoImpl.AdminDaoImpl;
import com.person.vo.Article;

/**
 * Servlet implementation class ArticleEditor
 */
//@WebServlet("/ArticleEditor")
public class ArticleEditor extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ArticleEditor() {}

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		response.setContentType("text/html; charset=UTF-8");
		request.setCharacterEncoding("UTF-8");
		AdminDaoImpl adi = new AdminDaoImpl();
		Article arti = new Article();
		int id = Integer.parseInt(request.getParameter("id"));
		String title = request.getParameter("title");
		String content = request.getParameter("content");
		String discript = request.getParameter("discript");
		
		arti.setId(id);
		arti.setTitle(title);
		arti.setContent(content);
		arti.setDecrip(discript);
		
		boolean flag = adi.articleModifyById(arti);
		if(flag) {//编辑成功
			
		}else {//编辑失败
			
		}
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
